#pragma once

#include <atlctrls.h>
#include <atlmisc.h>
#include <atlscrl.h>
#include <atlframe.h>
#include <atlwince.h>
#include <atlcrack.h>

#include <string>

#include "MainWndMode.h"
#include "MainWnd.h"

class MemoFile;

class MainWndMemoMode : public MainWndMode
{
public:

//    MainWndMemoMode( MainWnd& window, const std::wstring& fileName, bool unicode );
//    MainWndMemoMode( MainWnd& window, bool unicode );

    MainWndMemoMode( MainWnd& window, std::auto_ptr<MemoFile> memo );

    BEGIN_MSG_MAP_EX(MainWndMemoMode)
        MESSAGE_HANDLER(WM_SIZE, OnSize)
        COMMAND_ID_HANDLER( IDOK, OnOk )
        NOTIFY_CODE_HANDLER(GN_CONTEXTMENU, OnContextMenu)
    END_MSG_MAP() 

    void RecalcLayout();

private:

    void Init();

    LRESULT OnOk(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);

	LRESULT OnContextMenu(int /*idCtrl*/, LPNMHDR pnmh, BOOL& /*bHandled*/);
    LRESULT OnSize(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);

    MainWnd & host;
    MemoView & memoView;

    std::auto_ptr<MemoFile> memo;
};